<!DOCTYPE html>
<html lang="en">
<title>活动管理</title>
<#import "/layout/layout.html" as body/>
<@body.page>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title overflow">
                    <h5 class="pull-left">活动列表</h5>
                    <a href="to_activity_add" class="btn btn-sm btn-primary pull-right">新增活动</a>
                </div>
                <div class="ibox-content">

                    <div class="table-responsive">
                        <form class="form-inline" action="to_activity_list" role="form" id="form" method="post" accept-charset="UTF-8">
                            <div class="form-group margin-left">
                                <label for="daterange">活动名称：</label>
                                <input class="form-control" id="activityName" name="activityName" value="${activityName!}" type="text" placeholder="请输入用户名"/>
                            </div>
                            <div class="form-group margin-left">
                                <label for="daterange1">优惠券ID：</label>
                                <input class="form-control" id="couponId" name="couponId" value="${couponId!}" type="text" placeholder="优惠券ID"/>
                            </div>
                            <div class="form-group margin-left">
                                <label for="daterange2">被邀请人券ID：</label>
                                <input class="form-control" id="inviteCouponId" name="inviteCouponId" value="${inviteCouponId!}" type="text" placeholder="被邀请人券ID"/>
                            </div>
                            <input type="hidden" id="pageNum" name="pageNum" value="${pageNum!}"> 
                            <button type="submit" id="btn_submit" class="btn btn-outline btn-primary" style="margin-top: 5px">确认</button>
                        </form>
                        <hr>
                        <table class="table table-hover table-center dataTables-example">
                            <thead>
                            <tr>
                                <th>活动ID</th>
                                <th>活动名称</th>
                                <th>活动类型</th>
                                <th>优惠券ID</th>
                                <th>被邀请人券ID</th>
                                <th>创建时间</th>
                                <th>备注</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#if list??> <#list list as list>
								<tr>
									<td>${list.id!}</td>
									<td>${list.activityName!}</td>
									<td>
										
										<#if list.activityType = 0> 
										  完成订单后送优惠券
										<#else> 
										  点击链接送优惠券
										</#if>
									</td>
									<td>${list.couponId!}</td>
									<td>${list.inviteCouponId!}</td>
									<td>${list.createTime?date}</td>
									<td>${list.remark!}</td>
									<td>
										<a href="to_activity_edit?id=${list.id!}">
											<button type="button" class="btn btn-default"><i class="fa fa-pencil"></i> 编辑</button>
										</a>
									</td>
								</tr>
								</#list> 
								</#if>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="ibox-content overflow">
                    <h4 class="pull-left">合计:${pageSum!}条</h4>
                    <div id="copot-page" class="pull-right"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(document).ready(function () {
        //分页
        new Page({
            parent: $("#copot-page"),
            nowPage: ${pageNum!},
            pageSize: 10,
            totalCount: ${pageSum!},
            setting: {
                defaultPage: 7,//默认显示可点击分页的个数
                firstPageText: "首页",
                prevPageText: "上一页",
                nextPageText: "下一页",
                lastPageText: "尾页"
            },
            callback: function (nowPage, totalPage) {
            	nowPage == 0?1:nowPage;
                $("#pageNum").val(nowPage);
                $("#form").submit();
                
            }
        });
        
        $("#btn_submit").click(function(){
        	
        });
    });
</script>
</@body.page>
</html>